package com.azt.api.dto;

import com.xiaoleilu.hutool.util.StrUtil;
import org.jeecgframework.poi.excel.annotation.Excel;

import java.util.Map;

/**
 * Created by zouheyuan on 2017/4/25.
 */
public class PvDataDto {

    @Excel(name = "时间")
    private String createtime;

    @Excel(name = "询价浏览量")
    private Integer enquriy = 0;

    @Excel(name = "商铺浏览量")
    private Integer shop = 0;

    @Excel(name = "新闻浏览量")
    private Integer news = 0;

    @Excel(name = "商品浏览量")
    private Integer product = 0;


    public PvDataDto() {
    }


    public PvDataDto(Map<String, Object> params) {

        this.createtime = params.get("createtime").toString();
        String vs = params.get("vs").toString();
        if (StrUtil.isNotBlank(vs)) {
            String[] split = vs.split(",");
            for(int i = 0 ; i < split.length ; i ++) {
                String str = split[i];
                if(str.contains("enquiry")) this.enquriy = Integer.parseInt(str.split(":")[1].toString());
                if(str.contains("shop")) this.shop = Integer.parseInt(str.split(":")[1].toString());
                if(str.contains("news")) this.news = Integer.parseInt(str.split(":")[1].toString());
                if(str.contains("product")) this.product = Integer.parseInt(str.split(":")[1].toString());
            }
        }
    }


    public String getCreatetime() {
        return createtime;
    }

    public void setCreatetime(String createtime) {
        this.createtime = createtime;
    }

    public Integer getEnquriy() {
        return enquriy;
    }

    public void setEnquriy(Integer enquriy) {
        this.enquriy = enquriy;
    }

    public Integer getShop() {
        return shop;
    }

    public void setShop(Integer shop) {
        this.shop = shop;
    }

    public Integer getNews() {
        return news;
    }

    public void setNews(Integer news) {
        this.news = news;
    }

    public Integer getProduct() {
        return product;
    }

    public void setProduct(Integer product) {
        this.product = product;
    }
}
